<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>list courses</title>
</head>
<body>

<table width="100%" align="center">
<tr>
<td align="left" colspan="2">Moje szkolenia:</td>
</tr>
<tr>
<td width="100%" valign="top">
	<c:forEach items="${userCourseInfoList}" var="course">
		<div id="feedback">
			<span class="color color-1"></span>
			<span class="color color-2"></span>
			<span class="color color-3"></span>
			<span class="color color-4"></span>
			<span class="color color-5"></span>   
			<div class="section">        

		<table width="100%" height="200" >
			<tr>
				<td height="100%" valign="top">
					<table width="100%" height="100%">
						<tr >
							<td height="40" width="220" valign="top" align="left"><b>${course.course.title}</b></td>
						</tr>
						<tr>
							<td valign="top" align="left">${course.course.description}</td>
						</tr>
						<tr>
						<td height="20" align="left">
							Ostatnio otwierany: ${course.lastattempt}
						</td>
						</tr>
					</table>
				</td>
				<td width="190">
					<table width="100%" border="1">
						<tr>
							<td width="90" height="20">Ilość stron</td>
							<td width="30">${course.pages}</td>
						</tr>
						<tr>
							<td colspan="2">
								<span class="progressBar" id="element1${course.course.course_id}">${course.pagesProgress}%</span>
							</td>
						</tr>
					</table><br />
					<table width="100%" border="1">
						<tr>
							<td height="20">Test początkowy</td>
							<td>${course.starttest}</td>
						</tr>
						<tr>
							<td colspan="2">
								<span class="progressBar" id="element2${course.course.course_id}">${course.startTestProgress}%</span>
							</td>
						</tr>
					</table>
				</td>
				<td width="150">
					<table width="100%" height="100%">
						<tr>
							<td>
							<c:if test="${course.course.enabled=='true'}">
								<c:if test="${course.starttest_done=='false'}">
									<c:if test="${userInfo.firstname=='' || userInfo.birthdate=='' || userInfo.lastname=='' || userInfo.city==''}">
										<img width="40" height="40" src="<%= request.getContextPath() %>/resources/icons/calendar.png" /><br/>
										Zanim rozpoczniesz musisz uzupełnić swój profil.
									</c:if>
									<c:if test="${userInfo.firstname!='' && userInfo.birthdate!='' && userInfo.lastname!='' && userInfo.city!=''}">
										<form action="<%= request.getContextPath() %>/course/show/${100+course.course.course_id}">
											<button type="submit" class="skip">
												Test początkowy
											</button>
										</form>
									</c:if>
								</c:if>
								
								<c:if test="${course.starttest_done=='true'}"  >
									<form action="<%= request.getContextPath() %>/course/show/${course.course.course_id}">
										<c:if test="${course.pagesProgress>0}" >
											<button type="submit" class="skip">
												Kontynuuj szkolenie
											</button>
										</c:if >
										<c:if test="${course.pagesProgress==0}" >
											<button type="submit" class="skip">
												Rozpocznij szkolenie
											</button>
										</c:if >
									</form>
									<!-- 
									<c:if test="${course.endtest_done=='false' && course.pagesProgress==100}"  >
										<form action="<%= request.getContextPath() %>/course/show/${200+course.course.course_id}">
											<button type="submit" class="skip">
												Test końcowy
											</button>
										</form>
									</c:if>
									 -->
								</c:if>
								<c:if test="${course.endtest_done=='true'}"  >
									To szkolenie zostało ukończone. Zapraszamy Cię na szkolenie stacjonarne, podczs którego poprosimy Cię o rozwiązanie testu końcowego. Dziękujemy.
								</c:if>
							</c:if>
							
							<c:if test="${course.course.enabled=='false'}">
								To szkolenie jest nieaktywne.
							</c:if>
							</td>
						</tr>
					</table>
				</td>
				<td width="15" height="100%" align="right" valign="middle">
					<img width="15" height="100%" src="<%= request.getContextPath() %>/resources/images/line.png" /><br />
				</td>
				<td width="100" height="100%" valign="top">
					<c:if test="${course.course.enabled=='true'}">
						<p style="cursor: pointer;" onclick="TINY.box.show({html:'<b>Kontakt z trenerem:</b><br/>${course.course.coach}<br/>${course.course.coachInfo}<br/>${course.course.coachContact}<br/><br/><b>Administracja ePlatformy:</b><br/>kontakt@ess.edu.pl',animate:false,close:true,top:50})">
						Masz pytanie?
						</p>
						<c:if test="${course.pagesProgress==100}">
							<br/>
							<p style="cursor: pointer;"	onclick="TINY.box.show({html:'<b>Szkolenie stacjonarne:</b><br/>${course.course.summaryMeeting}',animate:false,close:true,top:50})">
							Szkolenie stacjonarne
							</p>
						</c:if>
					</c:if>
					<c:if test="${course.course.enabled=='false'}">
						<p style="cursor: pointer;" onclick="TINY.box.show({html:'<b>Kontakt z trenerem:</b><br/>${course.course.coach}<br/>${course.course.coachInfo}<br/>${course.course.coachContact}<br/><br/><b>Administracja ePlatformy:</b><br/>kontakt@ess.edu.pl',animate:false,close:true,top:50})">
						Masz pytanie?
						</p>
					</c:if>
				</td>
			</tr>
		</table>
						      
			    </div>
			</div>
	</c:forEach>
</td>
<td width="400" class="tab1" style="padding-left: 10px" valign="top">
<form:form modelAttribute="userInfo" action="${pageContext.request.contextPath}/user/update">
	<div id="feedback">
		<span class="color color-1"></span>
		<span class="color color-2"></span>
		<span class="color color-3"></span>
		<span class="color color-4"></span>
		<span class="color color-5"></span>   
		<div class="section"> 		
		<table width="100%" height="100%">
		Moje dane:
		<br /><br />
			<tr height="20">
			<td valign="middle">Imię</td>
			<td valign="middle"><form:input type="hidden" path="username"/><form:input path="firstname" /></td>
			</tr>
			<tr height="20">
			<td valign="middle">Nazwisko</td>
			<td valign="middle"><form:input path="lastname"/></td>
			</tr>
			<tr height="20">
			<td valign="middle">Data ur.</td>
			<td valign="middle"><form:input path="birthdate"/></td>
			</tr>
			<tr height="20">
			<td valign="middle">Ulica</td>
			<td valign="middle"><form:input path="street"/></td>
			</tr>
			<tr height="20">
			<td valign="middle">Miejscowość</td>
			<td valign="middle"><form:input path="city"/></td>
			</tr>
			<tr height="20">
			<td valign="middle">Kod pocztowy</td>
			<td valign="middle"><form:input path="post"/></td>
			</tr>
			<tr height="20">
			<td valign="middle">Nazwa firmy</td>
			<td valign="middle"><form:input path="companyname"/></td>
			</tr>
			<tr height="20">
			<td valign="middle">Adres firmy</td>
			<td valign="middle"><form:textarea rows="4" path="companyaddress"/></td>
			</tr>
			<tr>
			<td colspan="2" valign="top">
			<center><button type="submit" class="skip">
				Aktualizuj dane
				</button></center></td>
			</tr>
		</table>
		</div>
		</div>
	</form:form>
	</td>
</tr>
</table>

</body>
</html>
